<?php


abstract class BaseClients extends BaseObject  implements Persistent {


	
	protected static $peer;


	
	protected $id;


	
	protected $priority;


	
	protected $status_id;


	
	protected $name;


	
	protected $surname;


	
	protected $birtday;


	
	protected $sex;


	
	protected $country_code;


	
	protected $city;


	
	protected $address;


	
	protected $telfax;


	
	protected $gsm;


	
	protected $zip;


	
	protected $email;


	
	protected $is_company;


	
	protected $department_id;


	
	protected $updated_at;


	
	protected $created_at;

	
	protected $collClientsI18ns;

	
	protected $lastClientsI18nCriteria = null;

	
	protected $alreadyInSave = false;

	
	protected $alreadyInValidation = false;

  
  protected $culture;

	
	public function getId()
	{

		return $this->id;
	}

	
	public function getPriority()
	{

		return $this->priority;
	}

	
	public function getStatusId()
	{

		return $this->status_id;
	}

	
	public function getName()
	{

		return $this->name;
	}

	
	public function getSurname()
	{

		return $this->surname;
	}

	
	public function getBirtday($format = 'Y-m-d H:i:s')
	{

		if ($this->birtday === null || $this->birtday === '') {
			return null;
		} elseif (!is_int($this->birtday)) {
						$ts = strtotime($this->birtday);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [birtday] as date/time value: " . var_export($this->birtday, true));
			}
		} else {
			$ts = $this->birtday;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getSex()
	{

		return $this->sex;
	}

	
	public function getCountryCode()
	{

		return $this->country_code;
	}

	
	public function getCity()
	{

		return $this->city;
	}

	
	public function getAddress()
	{

		return $this->address;
	}

	
	public function getTelfax()
	{

		return $this->telfax;
	}

	
	public function getGsm()
	{

		return $this->gsm;
	}

	
	public function getZip()
	{

		return $this->zip;
	}

	
	public function getEmail()
	{

		return $this->email;
	}

	
	public function getIsCompany()
	{

		return $this->is_company;
	}

	
	public function getDepartmentId()
	{

		return $this->department_id;
	}

	
	public function getUpdatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->updated_at === null || $this->updated_at === '') {
			return null;
		} elseif (!is_int($this->updated_at)) {
						$ts = strtotime($this->updated_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [updated_at] as date/time value: " . var_export($this->updated_at, true));
			}
		} else {
			$ts = $this->updated_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function getCreatedAt($format = 'Y-m-d H:i:s')
	{

		if ($this->created_at === null || $this->created_at === '') {
			return null;
		} elseif (!is_int($this->created_at)) {
						$ts = strtotime($this->created_at);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse value of [created_at] as date/time value: " . var_export($this->created_at, true));
			}
		} else {
			$ts = $this->created_at;
		}
		if ($format === null) {
			return $ts;
		} elseif (strpos($format, '%') !== false) {
			return strftime($format, $ts);
		} else {
			return date($format, $ts);
		}
	}

	
	public function setId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->id !== $v) {
			$this->id = $v;
			$this->modifiedColumns[] = ClientsPeer::ID;
		}

	} 
	
	public function setPriority($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->priority !== $v) {
			$this->priority = $v;
			$this->modifiedColumns[] = ClientsPeer::PRIORITY;
		}

	} 
	
	public function setStatusId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->status_id !== $v) {
			$this->status_id = $v;
			$this->modifiedColumns[] = ClientsPeer::STATUS_ID;
		}

	} 
	
	public function setName($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->name !== $v) {
			$this->name = $v;
			$this->modifiedColumns[] = ClientsPeer::NAME;
		}

	} 
	
	public function setSurname($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->surname !== $v) {
			$this->surname = $v;
			$this->modifiedColumns[] = ClientsPeer::SURNAME;
		}

	} 
	
	public function setBirtday($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [birtday] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->birtday !== $ts) {
			$this->birtday = $ts;
			$this->modifiedColumns[] = ClientsPeer::BIRTDAY;
		}

	} 
	
	public function setSex($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->sex !== $v) {
			$this->sex = $v;
			$this->modifiedColumns[] = ClientsPeer::SEX;
		}

	} 
	
	public function setCountryCode($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->country_code !== $v) {
			$this->country_code = $v;
			$this->modifiedColumns[] = ClientsPeer::COUNTRY_CODE;
		}

	} 
	
	public function setCity($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->city !== $v) {
			$this->city = $v;
			$this->modifiedColumns[] = ClientsPeer::CITY;
		}

	} 
	
	public function setAddress($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->address !== $v) {
			$this->address = $v;
			$this->modifiedColumns[] = ClientsPeer::ADDRESS;
		}

	} 
	
	public function setTelfax($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->telfax !== $v) {
			$this->telfax = $v;
			$this->modifiedColumns[] = ClientsPeer::TELFAX;
		}

	} 
	
	public function setGsm($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->gsm !== $v) {
			$this->gsm = $v;
			$this->modifiedColumns[] = ClientsPeer::GSM;
		}

	} 
	
	public function setZip($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->zip !== $v) {
			$this->zip = $v;
			$this->modifiedColumns[] = ClientsPeer::ZIP;
		}

	} 
	
	public function setEmail($v)
	{

		
		
		if ($v !== null && !is_string($v)) {
			$v = (string) $v; 
		}

		if ($this->email !== $v) {
			$this->email = $v;
			$this->modifiedColumns[] = ClientsPeer::EMAIL;
		}

	} 
	
	public function setIsCompany($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->is_company !== $v) {
			$this->is_company = $v;
			$this->modifiedColumns[] = ClientsPeer::IS_COMPANY;
		}

	} 
	
	public function setDepartmentId($v)
	{

		
		
		if ($v !== null && !is_int($v) && is_numeric($v)) {
			$v = (int) $v;
		}

		if ($this->department_id !== $v) {
			$this->department_id = $v;
			$this->modifiedColumns[] = ClientsPeer::DEPARTMENT_ID;
		}

	} 
	
	public function setUpdatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [updated_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->updated_at !== $ts) {
			$this->updated_at = $ts;
			$this->modifiedColumns[] = ClientsPeer::UPDATED_AT;
		}

	} 
	
	public function setCreatedAt($v)
	{

		if ($v !== null && !is_int($v)) {
			$ts = strtotime($v);
			if ($ts === -1 || $ts === false) { 				throw new PropelException("Unable to parse date/time value for [created_at] from input: " . var_export($v, true));
			}
		} else {
			$ts = $v;
		}
		if ($this->created_at !== $ts) {
			$this->created_at = $ts;
			$this->modifiedColumns[] = ClientsPeer::CREATED_AT;
		}

	} 
	
	public function hydrate(ResultSet $rs, $startcol = 1)
	{
		try {

			$this->id = $rs->getInt($startcol + 0);

			$this->priority = $rs->getInt($startcol + 1);

			$this->status_id = $rs->getInt($startcol + 2);

			$this->name = $rs->getString($startcol + 3);

			$this->surname = $rs->getString($startcol + 4);

			$this->birtday = $rs->getTimestamp($startcol + 5, null);

			$this->sex = $rs->getString($startcol + 6);

			$this->country_code = $rs->getString($startcol + 7);

			$this->city = $rs->getString($startcol + 8);

			$this->address = $rs->getString($startcol + 9);

			$this->telfax = $rs->getString($startcol + 10);

			$this->gsm = $rs->getString($startcol + 11);

			$this->zip = $rs->getString($startcol + 12);

			$this->email = $rs->getString($startcol + 13);

			$this->is_company = $rs->getInt($startcol + 14);

			$this->department_id = $rs->getInt($startcol + 15);

			$this->updated_at = $rs->getTimestamp($startcol + 16, null);

			$this->created_at = $rs->getTimestamp($startcol + 17, null);

			$this->resetModified();

			$this->setNew(false);

						return $startcol + 18; 
		} catch (Exception $e) {
			throw new PropelException("Error populating Clients object", $e);
		}
	}

	
	public function delete($con = null)
	{
		if ($this->isDeleted()) {
			throw new PropelException("This object has already been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(ClientsPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			ClientsPeer::doDelete($this, $con);
			$this->setDeleted(true);
			$con->commit();
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	public function save($con = null)
	{
    if ($this->isModified() && !$this->isColumnModified(ClientsPeer::UPDATED_AT))
    {
      $this->setUpdatedAt(time());
    }

    if ($this->isNew() && !$this->isColumnModified(ClientsPeer::CREATED_AT))
    {
      $this->setCreatedAt(time());
    }

		if ($this->isDeleted()) {
			throw new PropelException("You cannot save an object that has been deleted.");
		}

		if ($con === null) {
			$con = Propel::getConnection(ClientsPeer::DATABASE_NAME);
		}

		try {
			$con->begin();
			$affectedRows = $this->doSave($con);
			$con->commit();
			return $affectedRows;
		} catch (PropelException $e) {
			$con->rollback();
			throw $e;
		}
	}

	
	protected function doSave($con)
	{
		$affectedRows = 0; 		if (!$this->alreadyInSave) {
			$this->alreadyInSave = true;


						if ($this->isModified()) {
				if ($this->isNew()) {
					$pk = ClientsPeer::doInsert($this, $con);
					$affectedRows += 1; 										 										 
					$this->setId($pk);  
					$this->setNew(false);
				} else {
					$affectedRows += ClientsPeer::doUpdate($this, $con);
				}
				$this->resetModified(); 			}

			if ($this->collClientsI18ns !== null) {
				foreach($this->collClientsI18ns as $referrerFK) {
					if (!$referrerFK->isDeleted()) {
						$affectedRows += $referrerFK->save($con);
					}
				}
			}

			$this->alreadyInSave = false;
		}
		return $affectedRows;
	} 
	
	protected $validationFailures = array();

	
	public function getValidationFailures()
	{
		return $this->validationFailures;
	}

	
	public function validate($columns = null)
	{
		$res = $this->doValidate($columns);
		if ($res === true) {
			$this->validationFailures = array();
			return true;
		} else {
			$this->validationFailures = $res;
			return false;
		}
	}

	
	protected function doValidate($columns = null)
	{
		if (!$this->alreadyInValidation) {
			$this->alreadyInValidation = true;
			$retval = null;

			$failureMap = array();


			if (($retval = ClientsPeer::doValidate($this, $columns)) !== true) {
				$failureMap = array_merge($failureMap, $retval);
			}


				if ($this->collClientsI18ns !== null) {
					foreach($this->collClientsI18ns as $referrerFK) {
						if (!$referrerFK->validate($columns)) {
							$failureMap = array_merge($failureMap, $referrerFK->getValidationFailures());
						}
					}
				}


			$this->alreadyInValidation = false;
		}

		return (!empty($failureMap) ? $failureMap : true);
	}

	
	public function getByName($name, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = ClientsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->getByPosition($pos);
	}

	
	public function getByPosition($pos)
	{
		switch($pos) {
			case 0:
				return $this->getId();
				break;
			case 1:
				return $this->getPriority();
				break;
			case 2:
				return $this->getStatusId();
				break;
			case 3:
				return $this->getName();
				break;
			case 4:
				return $this->getSurname();
				break;
			case 5:
				return $this->getBirtday();
				break;
			case 6:
				return $this->getSex();
				break;
			case 7:
				return $this->getCountryCode();
				break;
			case 8:
				return $this->getCity();
				break;
			case 9:
				return $this->getAddress();
				break;
			case 10:
				return $this->getTelfax();
				break;
			case 11:
				return $this->getGsm();
				break;
			case 12:
				return $this->getZip();
				break;
			case 13:
				return $this->getEmail();
				break;
			case 14:
				return $this->getIsCompany();
				break;
			case 15:
				return $this->getDepartmentId();
				break;
			case 16:
				return $this->getUpdatedAt();
				break;
			case 17:
				return $this->getCreatedAt();
				break;
			default:
				return null;
				break;
		} 	}

	
	public function toArray($keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = ClientsPeer::getFieldNames($keyType);
		$result = array(
			$keys[0] => $this->getId(),
			$keys[1] => $this->getPriority(),
			$keys[2] => $this->getStatusId(),
			$keys[3] => $this->getName(),
			$keys[4] => $this->getSurname(),
			$keys[5] => $this->getBirtday(),
			$keys[6] => $this->getSex(),
			$keys[7] => $this->getCountryCode(),
			$keys[8] => $this->getCity(),
			$keys[9] => $this->getAddress(),
			$keys[10] => $this->getTelfax(),
			$keys[11] => $this->getGsm(),
			$keys[12] => $this->getZip(),
			$keys[13] => $this->getEmail(),
			$keys[14] => $this->getIsCompany(),
			$keys[15] => $this->getDepartmentId(),
			$keys[16] => $this->getUpdatedAt(),
			$keys[17] => $this->getCreatedAt(),
		);
		return $result;
	}

	
	public function setByName($name, $value, $type = BasePeer::TYPE_PHPNAME)
	{
		$pos = ClientsPeer::translateFieldName($name, $type, BasePeer::TYPE_NUM);
		return $this->setByPosition($pos, $value);
	}

	
	public function setByPosition($pos, $value)
	{
		switch($pos) {
			case 0:
				$this->setId($value);
				break;
			case 1:
				$this->setPriority($value);
				break;
			case 2:
				$this->setStatusId($value);
				break;
			case 3:
				$this->setName($value);
				break;
			case 4:
				$this->setSurname($value);
				break;
			case 5:
				$this->setBirtday($value);
				break;
			case 6:
				$this->setSex($value);
				break;
			case 7:
				$this->setCountryCode($value);
				break;
			case 8:
				$this->setCity($value);
				break;
			case 9:
				$this->setAddress($value);
				break;
			case 10:
				$this->setTelfax($value);
				break;
			case 11:
				$this->setGsm($value);
				break;
			case 12:
				$this->setZip($value);
				break;
			case 13:
				$this->setEmail($value);
				break;
			case 14:
				$this->setIsCompany($value);
				break;
			case 15:
				$this->setDepartmentId($value);
				break;
			case 16:
				$this->setUpdatedAt($value);
				break;
			case 17:
				$this->setCreatedAt($value);
				break;
		} 	}

	
	public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
	{
		$keys = ClientsPeer::getFieldNames($keyType);

		if (array_key_exists($keys[0], $arr)) $this->setId($arr[$keys[0]]);
		if (array_key_exists($keys[1], $arr)) $this->setPriority($arr[$keys[1]]);
		if (array_key_exists($keys[2], $arr)) $this->setStatusId($arr[$keys[2]]);
		if (array_key_exists($keys[3], $arr)) $this->setName($arr[$keys[3]]);
		if (array_key_exists($keys[4], $arr)) $this->setSurname($arr[$keys[4]]);
		if (array_key_exists($keys[5], $arr)) $this->setBirtday($arr[$keys[5]]);
		if (array_key_exists($keys[6], $arr)) $this->setSex($arr[$keys[6]]);
		if (array_key_exists($keys[7], $arr)) $this->setCountryCode($arr[$keys[7]]);
		if (array_key_exists($keys[8], $arr)) $this->setCity($arr[$keys[8]]);
		if (array_key_exists($keys[9], $arr)) $this->setAddress($arr[$keys[9]]);
		if (array_key_exists($keys[10], $arr)) $this->setTelfax($arr[$keys[10]]);
		if (array_key_exists($keys[11], $arr)) $this->setGsm($arr[$keys[11]]);
		if (array_key_exists($keys[12], $arr)) $this->setZip($arr[$keys[12]]);
		if (array_key_exists($keys[13], $arr)) $this->setEmail($arr[$keys[13]]);
		if (array_key_exists($keys[14], $arr)) $this->setIsCompany($arr[$keys[14]]);
		if (array_key_exists($keys[15], $arr)) $this->setDepartmentId($arr[$keys[15]]);
		if (array_key_exists($keys[16], $arr)) $this->setUpdatedAt($arr[$keys[16]]);
		if (array_key_exists($keys[17], $arr)) $this->setCreatedAt($arr[$keys[17]]);
	}

	
	public function buildCriteria()
	{
		$criteria = new Criteria(ClientsPeer::DATABASE_NAME);

		if ($this->isColumnModified(ClientsPeer::ID)) $criteria->add(ClientsPeer::ID, $this->id);
		if ($this->isColumnModified(ClientsPeer::PRIORITY)) $criteria->add(ClientsPeer::PRIORITY, $this->priority);
		if ($this->isColumnModified(ClientsPeer::STATUS_ID)) $criteria->add(ClientsPeer::STATUS_ID, $this->status_id);
		if ($this->isColumnModified(ClientsPeer::NAME)) $criteria->add(ClientsPeer::NAME, $this->name);
		if ($this->isColumnModified(ClientsPeer::SURNAME)) $criteria->add(ClientsPeer::SURNAME, $this->surname);
		if ($this->isColumnModified(ClientsPeer::BIRTDAY)) $criteria->add(ClientsPeer::BIRTDAY, $this->birtday);
		if ($this->isColumnModified(ClientsPeer::SEX)) $criteria->add(ClientsPeer::SEX, $this->sex);
		if ($this->isColumnModified(ClientsPeer::COUNTRY_CODE)) $criteria->add(ClientsPeer::COUNTRY_CODE, $this->country_code);
		if ($this->isColumnModified(ClientsPeer::CITY)) $criteria->add(ClientsPeer::CITY, $this->city);
		if ($this->isColumnModified(ClientsPeer::ADDRESS)) $criteria->add(ClientsPeer::ADDRESS, $this->address);
		if ($this->isColumnModified(ClientsPeer::TELFAX)) $criteria->add(ClientsPeer::TELFAX, $this->telfax);
		if ($this->isColumnModified(ClientsPeer::GSM)) $criteria->add(ClientsPeer::GSM, $this->gsm);
		if ($this->isColumnModified(ClientsPeer::ZIP)) $criteria->add(ClientsPeer::ZIP, $this->zip);
		if ($this->isColumnModified(ClientsPeer::EMAIL)) $criteria->add(ClientsPeer::EMAIL, $this->email);
		if ($this->isColumnModified(ClientsPeer::IS_COMPANY)) $criteria->add(ClientsPeer::IS_COMPANY, $this->is_company);
		if ($this->isColumnModified(ClientsPeer::DEPARTMENT_ID)) $criteria->add(ClientsPeer::DEPARTMENT_ID, $this->department_id);
		if ($this->isColumnModified(ClientsPeer::UPDATED_AT)) $criteria->add(ClientsPeer::UPDATED_AT, $this->updated_at);
		if ($this->isColumnModified(ClientsPeer::CREATED_AT)) $criteria->add(ClientsPeer::CREATED_AT, $this->created_at);

		return $criteria;
	}

	
	public function buildPkeyCriteria()
	{
		$criteria = new Criteria(ClientsPeer::DATABASE_NAME);

		$criteria->add(ClientsPeer::ID, $this->id);

		return $criteria;
	}

	
	public function getPrimaryKey()
	{
		return $this->getId();
	}

	
	public function setPrimaryKey($key)
	{
		$this->setId($key);
	}

	
	public function copyInto($copyObj, $deepCopy = false)
	{

		$copyObj->setPriority($this->priority);

		$copyObj->setStatusId($this->status_id);

		$copyObj->setName($this->name);

		$copyObj->setSurname($this->surname);

		$copyObj->setBirtday($this->birtday);

		$copyObj->setSex($this->sex);

		$copyObj->setCountryCode($this->country_code);

		$copyObj->setCity($this->city);

		$copyObj->setAddress($this->address);

		$copyObj->setTelfax($this->telfax);

		$copyObj->setGsm($this->gsm);

		$copyObj->setZip($this->zip);

		$copyObj->setEmail($this->email);

		$copyObj->setIsCompany($this->is_company);

		$copyObj->setDepartmentId($this->department_id);

		$copyObj->setUpdatedAt($this->updated_at);

		$copyObj->setCreatedAt($this->created_at);


		if ($deepCopy) {
									$copyObj->setNew(false);

			foreach($this->getClientsI18ns() as $relObj) {
				$copyObj->addClientsI18n($relObj->copy($deepCopy));
			}

		} 

		$copyObj->setNew(true);

		$copyObj->setId(NULL); 
	}

	
	public function copy($deepCopy = false)
	{
				$clazz = get_class($this);
		$copyObj = new $clazz();
		$this->copyInto($copyObj, $deepCopy);
		return $copyObj;
	}

	
	public function getPeer()
	{
		if (self::$peer === null) {
			self::$peer = new ClientsPeer();
		}
		return self::$peer;
	}

	
	public function initClientsI18ns()
	{
		if ($this->collClientsI18ns === null) {
			$this->collClientsI18ns = array();
		}
	}

	
	public function getClientsI18ns($criteria = null, $con = null)
	{
				include_once 'lib/model/om/BaseClientsI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		if ($this->collClientsI18ns === null) {
			if ($this->isNew()) {
			   $this->collClientsI18ns = array();
			} else {

				$criteria->add(ClientsI18nPeer::ID, $this->getId());

				ClientsI18nPeer::addSelectColumns($criteria);
				$this->collClientsI18ns = ClientsI18nPeer::doSelect($criteria, $con);
			}
		} else {
						if (!$this->isNew()) {
												

				$criteria->add(ClientsI18nPeer::ID, $this->getId());

				ClientsI18nPeer::addSelectColumns($criteria);
				if (!isset($this->lastClientsI18nCriteria) || !$this->lastClientsI18nCriteria->equals($criteria)) {
					$this->collClientsI18ns = ClientsI18nPeer::doSelect($criteria, $con);
				}
			}
		}
		$this->lastClientsI18nCriteria = $criteria;
		return $this->collClientsI18ns;
	}

	
	public function countClientsI18ns($criteria = null, $distinct = false, $con = null)
	{
				include_once 'lib/model/om/BaseClientsI18nPeer.php';
		if ($criteria === null) {
			$criteria = new Criteria();
		}
		elseif ($criteria instanceof Criteria)
		{
			$criteria = clone $criteria;
		}

		$criteria->add(ClientsI18nPeer::ID, $this->getId());

		return ClientsI18nPeer::doCount($criteria, $distinct, $con);
	}

	
	public function addClientsI18n(ClientsI18n $l)
	{
		$this->collClientsI18ns[] = $l;
		$l->setClients($this);
	}

  public function getCulture()
  {
    return $this->culture;
  }

  public function setCulture($culture)
  {
    $this->culture = $culture;
  }

  public function getPosition()
  {
    $obj = $this->getCurrentClientsI18n();

    return ($obj ? $obj->getPosition() : null);
  }

  public function setPosition($value)
  {
    $this->getCurrentClientsI18n()->setPosition($value);
  }

  public function getText()
  {
    $obj = $this->getCurrentClientsI18n();

    return ($obj ? $obj->getText() : null);
  }

  public function setText($value)
  {
    $this->getCurrentClientsI18n()->setText($value);
  }

  protected $current_i18n = array();

  public function getCurrentClientsI18n()
  {
    if (!isset($this->current_i18n[$this->culture]))
    {
      $obj = ClientsI18nPeer::retrieveByPK($this->getId(), $this->culture);
      if ($obj)
      {
        $this->setClientsI18nForCulture($obj, $this->culture);
      }
      else
      {
        $this->setClientsI18nForCulture(new ClientsI18n(), $this->culture);
        $this->current_i18n[$this->culture]->setCulture($this->culture);
      }
    }

    return $this->current_i18n[$this->culture];
  }

  public function setClientsI18nForCulture($object, $culture)
  {
    $this->current_i18n[$culture] = $object;
    $this->addClientsI18n($object);
  }

} 